
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <h4 class="text-danger">请填写以下信息</h4>
        </div>
        <div class="modal-body">
            <div class="form-group">
                <label>请填写已选择课程的课程号</label>
                <input type="text" class="form-control kechen1" >
            </div>
            <div class="form-group">
                <label>请填写已通过课程的课程号</label>
                <input type="text" class="form-control kechen2" >
            </div>
            <h6>注：*课程号与课程号之间用<mark>中文逗号</mark>分开*</h6>
        </div>
        <div class="modal-footer">
            <a class="btn btn-primary" data-dismiss="modal">确认提交</a>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal"> &times;</button>
                <h4 class="text-success">提示</h4>
            </div>
            <div class="modal-body">
                <h5>提交成功</h5>
            </div>
            <div class="modal-footer">
                <a class="btn btn-primary" data-dismiss="modal">确认</a>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button class="close" data-dismiss="modal"> &times;</button>
                                <h4 class="text-error">提示</h4>
                            </div>
                            <div class="modal-body">
                                <h5>提交失败</h5>
                            </div>
                            <div class="modal-footer">
                                <a class="btn btn-primary" data-dismiss="modal">确认</a>
                            </div>
                        </div>
                    </div>
                </div>
<script>
    $('.btn').click(function () {
        var str1 = $('.kechen1').val()
        var str2 = $('.kechen2').val()
        var arr1 = str1.split('，')
        var arr2 = str2.split('，')
        var obj = {
            cno_array : arr1,
            passed_cno_array : arr2
        }
        $.ajax({
            url: "/reg-course",
            type: 'POST',
            data: obj,
            success: function (data) {
                if (data.status == 0) {
                    $('#myModal').modal()
                } else if (data.status == 1){
                    $('#myModal2').modal()
                }
            },
            error: function (data) {
                console.log(data);
            }
        })
    })
</script>
